package com.cxb;

import android.os.Bundle;
import android.text.InputFilter;
import android.widget.Toast;

import com.cxb.utils.CommonUtils;
import com.cxb.utils.SharedPreferencesUtils;
import com.cxb.view.TTSToast;
import com.cxb.R;

/**
 * @ClassName: PickproofActivity
 * @Description: 防盗号码设置
 * @author 杨瑜 45154139@qq.com
 * @date 2013-9-26 下午4:17:06
 * 
 */
public class PickproofActivity extends SettingNumberActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		sp = new SharedPreferencesUtils(PickproofActivity.this);
		tvPhoneName.setText(R.string.cheat_number);
		sPhoneNumber = sp.getPickproofNumber();
		etPhoneNumber.setText(sPhoneNumber);
		etPhoneNumber.setFilters(new InputFilter[] { new InputFilter.LengthFilter(11) });
		etPhoneNumber.setSelection(etPhoneNumber.getText().toString().length());
	}

	@Override
	protected void save() {
		// TODO Auto-generated method stub
//		super.save();
		if (CommonUtils.isMobileNO(etPhoneNumber.getText().toString())) {
			sp.setPickproofNumber(etPhoneNumber.getText().toString());
			TTSToast.show(getApplicationContext(),
					getString(R.string.save_success), Toast.LENGTH_SHORT);
		} else {
			TTSToast.show(getApplicationContext(),
					getString(R.string.input_error), Toast.LENGTH_SHORT);
		}
	}
}
